Limit scope of variables and functions that are not meant to be shared. (#188)
authortsteven4 <tsteven4@users.noreply.github.com>
Wed, 6 Jun 2018 20:23:52 +0000 (14:23 -0600)
committerGitHub <noreply@github.com>
Wed, 6 Jun 2018 20:23:52 +0000 (14:23 -0600)
restrict unshared variables and functions to file scope.

58 files changed:
alan.cc
an1.cc
an1sym.h
arcdist.cc
bcr.cc
brauniger_iq.cc
bushnell.cc
dg-100.cc
duplicate.cc
enigma.cc
exif.cc
explorist_ini.cc
garmin.cc
garmin_device_xml.cc
gdb.cc
geo.cc
geojson.cc
googledir.cc
gopal.cc
gpx.cc
gtm.cc
gtrnctr.cc
holux.cc
igo8.cc
inifile.cc
interpolate.cc
itracku.cc
kml.cc
lmx.cc
magproto.cc
make-an1sym.pl
mapfactor.cc
mapsend.cc
mapsource.cc
mtk_locus.cc
mtk_logger.cc
nmea.cc
ozi.cc
pcx.cc
pocketfms_wp.cc
polygon.cc
position.cc
psitrex.cc
radius.cc
reverse_route.cc
saroute.cc
shape.cc
skytraq.cc
smplrout.cc
sort.cc
stackfilter.cc
subrip.cc
tomtom.cc
tpo.cc
v900.cc
validate.cc
vpl.cc
wfff_xml.cc

diff --git a/alan.cc b/alan.cc
index 8950e4ff243f92de798fe10556d84e350bfafd21..5154e612811693a32db9469f6be9256d2df4dfcb 100644 (file)
--- a/alan.cc
+++ b/alan.cc
@@ -175,8 +175,8 @@ enum {
 /**************************************************************************/
 
 static gbfile* fin = nullptr, *fout = nullptr;
-struct wprdata WPR;
-struct trldata TRL;
+static struct wprdata WPR;
+static struct trldata TRL;
 
 static arglist_t wpr_args[] = {
   /*
diff --git a/an1.cc b/an1.cc
index ebbc89c3cdda18ae6534140d9a76344b26d80283..6719f62b7413fa490687af086d880c5474655f39 100644 (file)
--- a/an1.cc
+++ b/an1.cc
@@ -53,7 +53,7 @@ typedef struct roadchange {
   char* name;
 } roadchange;
 
-roadchange* roadchanges = nullptr;
+static roadchange* roadchanges = nullptr;
 
 static
 arglist_t an1_args[] = {
@@ -250,7 +250,7 @@ typedef struct {
 
 static an1_waypoint_record* Alloc_AN1_Waypoint();
 
-void Destroy_AN1_Waypoint(void* vwpt)
+static void Destroy_AN1_Waypoint(void* vwpt)
 {
 
   an1_waypoint_record* wpt = (an1_waypoint_record*)vwpt;
@@ -269,7 +269,7 @@ void Destroy_AN1_Waypoint(void* vwpt)
   xfree(vwpt);
 }
 
-void Copy_AN1_Waypoint(void** vdwpt, void* vwpt)
+static void Copy_AN1_Waypoint(void** vdwpt, void* vwpt)
 {
   an1_waypoint_record* wpt = (an1_waypoint_record*)vwpt;
   an1_waypoint_record* dwpt = Alloc_AN1_Waypoint();
@@ -295,12 +295,12 @@ static an1_waypoint_record* Alloc_AN1_Waypoint()
 
 static an1_vertex_record* Alloc_AN1_Vertex();
 
-void Destroy_AN1_Vertex(void* vvertex)
+static void Destroy_AN1_Vertex(void* vvertex)
 {
   xfree(vvertex);
 }
 
-void Copy_AN1_Vertex(void** vdvert, void* vvert)
+static void Copy_AN1_Vertex(void** vdvert, void* vvert)
 {
   an1_vertex_record* vert = (an1_vertex_record*)vvert;
   an1_vertex_record* dvert = Alloc_AN1_Vertex();
@@ -322,14 +322,14 @@ static an1_vertex_record* Alloc_AN1_Vertex()
 
 static an1_line_record* Alloc_AN1_Line();
 
-void Destroy_AN1_Line(void* vline)
+static void Destroy_AN1_Line(void* vline)
 {
   an1_line_record* line = (an1_line_record*)vline;
   xfree(line->name);
   xfree(vline);
 }
 
-void Copy_AN1_Line(void** vdline, void* vline)
+static void Copy_AN1_Line(void** vdline, void* vline)
 {
   an1_line_record* line = (an1_line_record*)vline;
   an1_line_record* dline = Alloc_AN1_Line();
index f13cfd557e210d46bd7f6990b2d1a53660136fc1..2e33d3094c8d34764e7a95f69bdc207efda13f10 100644 (file)
--- a/an1sym.h
+++ b/an1sym.h
@@ -60,7 +60,7 @@
 
  */
 
-struct defguid {
+static struct defguid {
   GUID guid;
   const char* name;
 } default_guids[] = {
@@ -708,7 +708,7 @@ struct defguid {
   },
 };
 
-int FindIconByName(const char* name, GUID* guid)
+static int FindIconByName(const char* name, GUID* guid)
 {
   unsigned int i = 0;
   for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) {
@@ -720,7 +720,7 @@ int FindIconByName(const char* name, GUID* guid)
   return 0;
 }
 
-int FindIconByGuid(GUID* guid, char** name)
+static int FindIconByGuid(GUID* guid, char** name)
 {
   unsigned int i = 0;
   for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) {
index 40a86378e7c53f27d35f02bf7ee06496b4ad100c..3b52e3bc10835aa67a207b1b74a7165dde345f53 100644 (file)
@@ -153,7 +153,7 @@ arcdist_arc_disp_hdr_cb(const route_head*)
   arcdist_arc_disp_wpt_cb(nullptr);
 }
 
-void
+static void
 arcdist_process()
 {
   queue* elem, * tmp;
@@ -267,7 +267,7 @@ arcdist_process()
   }
 }
 
-void
+static void
 arcdist_init(const char*)
 {
   char* fm;
@@ -290,7 +290,7 @@ arcdist_init(const char*)
   }
 }
 
-void
+static void
 arcdist_deinit()
 {
   /* do nothing */
diff --git a/bcr.cc b/bcr.cc
index b9321759b2592805f52b65799d7c5aa32e6c9449..9cfe5c8348256346ce094fb02fe7ea7bd723eb68 100644 (file)
--- a/bcr.cc
+++ b/bcr.cc
@@ -242,7 +242,7 @@ bcr_wgs84_to_mercator(const double lat, const double lon, int* north, int* east)
   *east = E;
 }
 
-void
+static void
 bcr_mercator_to_wgs84(const int north, const int east, double* lat, double* lon)
 {
   *lat = 2 * (atan(exp(north / radius)) - M_PI / 4) / M_PI * (double)180;
@@ -356,7 +356,7 @@ bcr_write_wpt(const Waypoint*)
 {
 }
 
-void bcr_write_line(gbfile* fout, const QString& key, int* index, const QString& value)
+static void bcr_write_line(gbfile* fout, const QString& key, int* index, const QString& value)
 {
   if (value.isEmpty()) {                       /* this is mostly used in the world of windows */
     /* so we respectfully add a CR/LF on each line */
index 9996efa636468f4a1de41cecb5cfe8a1ad93e2c7..17d6c570fc3980c81ceb8758113cba547f317904 100644 (file)
@@ -46,7 +46,7 @@ typedef enum {
   st_sample_spd,
   num_states
 } state_t;
-state_t state;
+static state_t state;
 #if __cplusplus
 inline state_t operator++(state_t& rs, int)
 {
index 4945aced9393481487e2da8ee9549e6b113a3a0d..7d16d2b674875fee801fc37b5b314f6c7c5de8d5 100644 (file)
@@ -42,7 +42,7 @@ typedef struct  {
   const char* icon;
 } icon_mapping_t;
 
-icon_mapping_t bushnell_icons[] = {
+static icon_mapping_t bushnell_icons[] = {
   { 0x00, "Yellow Square"},
   { 0x01, "Blue Grey Circle" },
   { 0x02, "Yellow Diamond" },
index b98d63505738f0c97ecab64e99fb2ce707caede2..aa0c224fd3f1ace3a2bdc72d0314105ddbff47d7 100644 (file)
--- a/dg-100.cc
+++ b/dg-100.cc
@@ -77,7 +77,7 @@ struct dg100_command {
   const char* text;    /* Textual description for debugging */
 };
 
-struct dg100_command dg100_commands[] = {
+static struct dg100_command dg100_commands[] = {
   { dg100cmd_getfile,        2, 1024,    2, "getfile" },
   /* the getfileheader answer has variable length, -1 is a dummy value */
   { dg100cmd_getfileheader,  2,   -1,    2, "getfileheader"  },
@@ -89,7 +89,7 @@ struct dg100_command dg100_commands[] = {
   { dg100cmd_gpsmouse,       1,    0,    0, "gpsmouse" }
 };
 
-struct dg100_command dg200_commands[] = {
+static struct dg100_command dg200_commands[] = {
   { dg100cmd_getfile,        2, 1024,    2, "getfile" },
   /* the getfileheader answer has variable length, -1 is a dummy value */
   { dg100cmd_getfileheader,  2,   -1,    2, "getfileheader"  },
index 0e27819996b8b082b81a06bf2402b1076e0ce604..afd7d76ba4d76e98a88518e0efe1b89a988de20e 100644 (file)
@@ -95,7 +95,7 @@ addnode(btree_node* tree, btree_node* newnode, btree_node** oldnode)
   return (tree);
 }
 
-void
+static void
 free_tree(btree_node* tree)
 {
   if (tree->left) {
index 1988cd6c1786ef8ebf2f0c5a3103aef29a874968..9fbf0ef017ff13ad9ae84b34e50107b4ec8eb5ee 100644 (file)
--- a/enigma.cc
+++ b/enigma.cc
@@ -81,7 +81,7 @@ rd_init(const QString& fname)
   file_in = gbfopen_le(fname, "rb", MYNAME);
 }
 
-int32_t decToEnigmaPosition(double val)
+static int32_t decToEnigmaPosition(double val)
 {
   int degrees = fabs(val);
   double frac = fabs(val) - degrees;
@@ -91,7 +91,7 @@ int32_t decToEnigmaPosition(double val)
   return sign * (enigmadeg + enigmafrac);
 }
 
-float enigmaPositionToDec(int32_t val)
+static float enigmaPositionToDec(int32_t val)
 {
   int deg = abs(val) / 180000;
   int enigmafrac = abs(val) % 180000;
diff --git a/exif.cc b/exif.cc
index 06a1e5bbed8e3ebd75732b509d3206f845df68d7..69eca6c80a0938e38883d88d325a423c6822e9a6 100644 (file)
--- a/exif.cc
+++ b/exif.cc
@@ -133,8 +133,8 @@ typedef struct exif_app_s {
 static gbfile* fin, *fout;
 static queue exif_apps;
 static exif_app_t* exif_app;
-const Waypoint* exif_wpt_ref;
-time_t exif_time_ref;
+static const Waypoint* exif_wpt_ref;
+static time_t exif_time_ref;
 static char exif_success;
 static QString exif_fout_name;
 
@@ -142,7 +142,7 @@ static char* opt_filename, *opt_overwrite, *opt_frame, *opt_name;
 
 static uint8_t writer_gps_tag_version[4] = {2, 0, 0, 0};
 
-arglist_t exif_args[] = {
+static arglist_t exif_args[] = {
   { "filename", &opt_filename, "Set waypoint name to source filename", "Y", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr },
   { "frame", &opt_frame, "Time-frame (in seconds)", "10", ARGTYPE_INT, "0", nullptr, nullptr },
   { "name", &opt_name, "Locate waypoint for tagging by this name", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr },
index 889aa2c0212a72f3f2bcbcc959930d3155ef7e4e..472117a43c181b4c53e09ad09c1aa0c9227636f2 100644 (file)
@@ -5,11 +5,13 @@
 static inifile_t* inifile;
 static const char myname[] = "explorist";
 
-const char*
+#ifdef DEAD_CODE_IS_REBORN
+static const char*
 explorist_read_value(const char* section, const char* key)
 {
   return inifile_readstr(inifile, section, key);
 }
+#endif
 
 static mag_info*
 explorist_ini_try(const char* path)
index 2eeb9d8027753bbabb6a5a2b918e3e14982ed4a1..49ae9c40feb41ddca6deeef077713e0c570c045a 100644 (file)
--- a/garmin.cc
+++ b/garmin.cc
@@ -443,7 +443,7 @@ static int lap_read_nop_cb(int, struct GPS_SWay**)
 
 // returns 1 if the waypoint's start_time can be found
 // in the laps array, 0 otherwise
-unsigned int checkWayPointIsAtSplit(Waypoint* wpt, GPS_PLap* laps, int nlaps)
+static unsigned int checkWayPointIsAtSplit(Waypoint* wpt, GPS_PLap* laps, int nlaps)
 {
   int result = 0;
 
@@ -888,7 +888,7 @@ waypt_write_cb(GPS_PWay*)
  * If we're using smart names, try to put the cache info in the
  * description.
  */
-const char*
+static const char*
 get_gc_info(Waypoint* wpt)
 {
   if (global_opts.smart_names) {
index 800aa3a078fe0adf486c0a216f93862e534eca5f..ca2a7546f6b93cb91e2808c6834a2ab2e934f9d3 100644 (file)
@@ -40,7 +40,7 @@ static char* mountpoint, *base, *path, *ext;
 static xg_callback device_s, id_s, path_s, ext_s, base_s, dir_s;
 jmp_buf gdx_jmp_buf;
 
-void type_s(xg_string args, const QXmlStreamAttributes*)
+static void type_s(xg_string args, const QXmlStreamAttributes*)
 {
   type = args.compare(QLatin1String("GPSData"));
 }
diff --git a/gdb.cc b/gdb.cc
index 348b56806ff6078c5f426814963e1b93d04c0522..8e959c2678db818528f2264c3f212873f3744855 100644 (file)
--- a/gdb.cc
+++ b/gdb.cc
@@ -182,7 +182,7 @@ disp_summary(const gbfile* f)
 
 static char* gdb_fread_cstr(gbfile* fin);
 
-QString fread_cstr()
+static QString fread_cstr()
 {
   QString rv;
   char* s = gdb_fread_cstr(fin);
@@ -361,7 +361,7 @@ gdb_add_route_waypt(route_head* rte, Waypoint* ref, const int wpt_class)
 /*******************************************************************************/
 /* TOOLS AND MACROS FOR THE WRITER */
 /*-----------------------------------------------------------------------------*/
-void FWRITE_CSTR(QString a)  {
+static void FWRITE_CSTR(QString a)  {
   if (a.isEmpty()) {
     gbfputc(0, fout);
     return;
diff --git a/geo.cc b/geo.cc
index eb368ccc41213194122e7d451f151debf4307d78..a04d3bb1a4554b21902f860c7f777783bfd325ba 100644 (file)
--- a/geo.cc
+++ b/geo.cc
@@ -38,12 +38,12 @@ arglist_t geo_args[] = {
 #define MYNAME "geo"
 
 // This really should be class-local...
-QXmlStreamReader reader;
-QString geo_read_fname;
+static QXmlStreamReader reader;
+static QString geo_read_fname;
 
-geocache_container wpt_container(const QString&);
+static geocache_container wpt_container(const QString&);
 
-void GeoReadLoc()
+static void GeoReadLoc()
 {
   Waypoint* wpt = nullptr;
   QString current_tag;
index 6a303218309e778f8a9dcff88c6a6dd48a678bba..02d5137f8622ba1e1b48f7020e76621631997eec 100644 (file)
@@ -58,7 +58,7 @@ geojson_rd_init(const QString& fname) {
        input_file_name = fname;
 }
 
-QJsonArray* feature_collection = nullptr;
+static QJsonArray* feature_collection = nullptr;
 
 static void
 geojson_wr_init(const QString& fname) {
index 3add146cc9e93fa32b1e61929020072d06a1cec2..aa6a6983457e36cfec5441cc2b9ffdcdea20b39f 100644 (file)
@@ -63,7 +63,7 @@ goog_instr(xg_string args, const QXmlStreamAttributes*)
 
 static int goog_step = 0;
 
-long
+static long
 decode_goog64(const QByteArray& str, int& pos)
 {
   long result = 0;
index f62f0fa1e93bb132c17b1f8e965315b3cd696792..3b12daabaf81612ed5350d6c5ce81df9274fa44a 100644 (file)
--- a/gopal.cc
+++ b/gopal.cc
@@ -65,7 +65,7 @@
 static gbfile* fin, *fout;
 
 static struct tm tm,filenamedate, trackdate;
-time_t         tx;
+static time_t          tx;
 static char* optdate=nullptr;
 static char* optmaxspeed=nullptr;
 static char* optminspeed=nullptr;
@@ -83,7 +83,7 @@ arglist_t gopal_args[] = {
 
 #define CHECK_BOOL(a) if (a && (*a == '0')) a = NULL
 
-int gopal_check_line(char* line)
+static int gopal_check_line(char* line)
 {
   char* c = line;
   int i = 0;
diff --git a/gpx.cc b/gpx.cc
index 2b9e6c672c46e3e3a4a40710583f56ed4bf6c036..5b6b7f3abe65e4fd69a1234a71e5c0751a49e553 100644 (file)
--- a/gpx.cc
+++ b/gpx.cc
@@ -47,7 +47,7 @@ static int logpoint_ct = 0;
 static int elevation_precision;
 
 // static char* gpx_version = NULL;
-QString gpx_version;
+static QString gpx_version;
 static char* gpx_wversion;
 static int gpx_wversion_num;
 static QXmlStreamAttributes gpx_namespace_attribute;
@@ -303,7 +303,7 @@ typedef struct tag_mapping {
   {type, 0, "/gpx/" name}, \
   {type, 0, "/gpx/metadata/" name}
 
-tag_mapping tag_path_map[] = {
+static tag_mapping tag_path_map[] = {
   { tt_gpx, 0, "/gpx" },
   METATAG(tt_name, "name"),
   METATAG(tt_desc, "desc"),
@@ -423,7 +423,7 @@ tag_mapping tag_path_map[] = {
 };
 
 // Maintain a fast mapping from full tag names to the struct above.
-QHash<QString, tag_mapping*> hash;
+static QHash<QString, tag_mapping*> hash;
 
 static tag_type
 get_tag(const QString& t, int* passthrough)
@@ -1345,7 +1345,7 @@ gpx_wr_deinit()
   mkshort_del_handle(&mkshort_handle);
 }
 
-void
+static void
 gpx_read()
 {
   for (bool atEnd = false; !reader->atEnd() && !atEnd;)  {
diff --git a/gtm.cc b/gtm.cc
index fea8e60cf69cc416b82b30999c18d6ef3510f6e7..985183ab8ae6b7e8ddd9e3a41aed83d73122b41c 100644 (file)
--- a/gtm.cc
+++ b/gtm.cc
@@ -72,7 +72,7 @@ fread_bool(gbfile* fd)
 #define fread_single(a) gbfgetflt(a)
 #define fread_double(a) gbfgetdbl(a)
 
-QString
+static QString
 fread_string(gbfile* fd)
 {
   char* val;
@@ -99,7 +99,7 @@ fread_string_discard(gbfile* fd)
   fread_string(fd);
 }
 
-QString
+static QString
 fread_fixedstring(gbfile* fd, int len)
 {
   char* val = (char*) xmalloc(len+1);
@@ -155,7 +155,7 @@ fwrite_string(gbfile* fd, const QString& str)
   }
 }
 
-void
+static void
 fwrite_fixedstring(gbfile* fd, const char* str, int fieldlen)
 {
   int len = str ? strlen(str) : 0;
@@ -171,7 +171,7 @@ fwrite_fixedstring(gbfile* fd, const char* str, int fieldlen)
   }
 }
 
-void
+static void
 fwrite_fixedstring(gbfile* fd, const QString& str, int fieldlen)
 {
   fwrite_fixedstring(fd, CSTR(str), fieldlen);
@@ -323,7 +323,7 @@ static const int indatum_array[MAX_INDATUM_INDEX] = {
   116 // < 263 : Wake Eniwetok 1960
 };
 
-void set_datum(int n)
+static void set_datum(int n)
 {
   indatum = -1;
   if (n > 0 && n < MAX_INDATUM_INDEX) {
@@ -380,7 +380,7 @@ static const char* icon_descr[] = {
 };
 
 
-void convert_datum(double* lat, double* lon)
+static void convert_datum(double* lat, double* lon)
 {
   double amt;
   if (indatum != -1 && indatum != 118) {
@@ -738,4 +738,4 @@ ff_vecs_t gtm_vecs = {
   CET_CHARSET_ASCII, 0, /* CET-REVIEW */
   NULL_POS_OPS,
   nullptr
-};
\ No newline at end of file
+};
index 5e6cb281ec473d8380eb1f313548d9bb3bfcaa92..98d5a2856720554dca1fcd8331ae88745066d961 100644 (file)
@@ -451,7 +451,7 @@ gtc_crs_ftr(const route_head*)
 
 }
 
-void
+static void
 gtc_write()
 {
   gtc_write_xml(0, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\n");
index d83669c6d474f28aaaf32b2ab0b1455c7b637d2d..3f04a9df51b1110dac05b84125f924826869064e 100644 (file)
--- a/holux.cc
+++ b/holux.cc
@@ -154,7 +154,7 @@ static void data_read()
 
 
 
-const char* mknshort(const char* stIn,unsigned int sLen)
+static const char* mknshort(const char* stIn,unsigned int sLen)
 {
 #define MAX_STRINGLEN 255
   static char strOut[MAX_STRINGLEN];
diff --git a/igo8.cc b/igo8.cc
index c2d7e0127d793ca368e4b08d37b8cbd3c6594302..d8a5c9510464e44805b3b88ac5ec7ae6b43fbb7a 100644 (file)
--- a/igo8.cc
+++ b/igo8.cc
@@ -238,7 +238,7 @@ static void write_igo8_track_point(const Waypoint* wpt)
 
 // Write src unicode str to the dst cstring using unicode characters
 // All lengths are in bytes
-unsigned int print_unicode(char* dst, const unsigned int dst_max_length, short* src, unsigned int src_len)
+static unsigned int print_unicode(char* dst, const unsigned int dst_max_length, short* src, unsigned int src_len)
 {
   // Check to see what length we were passed, if the length doesn't include the null
   // then we make it include the null
@@ -277,7 +277,7 @@ unsigned int print_unicode(char* dst, const unsigned int dst_max_length, short*
 //                     string, validate that the use of the CET library provides
 //                     conmforming output, remove my old junk converter code.
 
-unsigned int ascii_to_unicode_2(char* dst, const unsigned int dst_max_length, const char* src)
+static unsigned int ascii_to_unicode_2(char* dst, const unsigned int dst_max_length, const char* src)
 {
   short* unicode;
   int len;
@@ -292,7 +292,7 @@ unsigned int ascii_to_unicode_2(char* dst, const unsigned int dst_max_length, co
   return len;
 }
 
-void write_header()
+static void write_header()
 {
   char header[IGO8_HEADER_SIZE] = {'\0'};
   igo8_id_block tmp_id_block;
index 98cd51bb5520d8dc53cae934788770cc60e50528..f24233d6a0f49cf5ff0c73a9a8f801cca605f0b1 100644 (file)
@@ -49,7 +49,7 @@ typedef struct inifile_section_s {
 #define GPSBABEL_SUBDIR ".gpsbabel"
 
 /* Remember the filename we used so we can include it in errors. */
-QString gbinipathname;
+static QString gbinipathname;
 
 static QString
 find_gpsbabel_inifile(const QString& path)  /* can be empty or NULL */
index 538c104b36d1c1265a096883def7325a831313ba..9407ea4e860e0fd45a7a56a691e439a3a26ec151 100644 (file)
@@ -28,9 +28,9 @@
 #define MYNAME "Interpolate filter"
 
 static char* opt_interval = nullptr;
-unsigned int interval = 0;
+static unsigned int interval = 0;
 static char* opt_dist = nullptr;
-double dist = 0;
+static double dist = 0;
 static char* opt_route = nullptr;
 
 static
@@ -52,7 +52,7 @@ arglist_t interpfilt_args[] = {
   ARG_TERMINATOR
 };
 
-void
+static void
 interpfilt_process()
 {
   queue* backuproute = nullptr;
@@ -172,7 +172,7 @@ interpfilt_process()
   xfree(backuproute);
 }
 
-void
+static void
 interpfilt_init(const char*)
 {
 
index 64d34b25ea8a2fff2aa932fd67df9ab64d4c9d44..effa3c292c197921ac507a102315273484a6b5a6 100644 (file)
@@ -198,7 +198,7 @@ itracku_device_update_data_read(void* buf, int len)
 // mysterious, but not worth tracking down at this time.   When xcode 4 comes
 // along (or anyone really cares about mega performance of this fairly obscure
 // target, we should revisit this.
-double
+static double
 deg_min_to_deg(volatile uint32_t x)
 {
   double sign;
@@ -227,7 +227,7 @@ deg_min_to_deg(volatile uint32_t x)
 /*
        Convert degrees to the degrees format of itracku.
 */
-uint32_t
+static uint32_t
 deg_to_deg_min(double x)
 {
   int32_t sign;
@@ -324,7 +324,7 @@ to_itracku_data_record(const Waypoint* wp, itracku_data_record* d)
        Returns gbser_OK if the initialization is sucessful, a
        non-zero integer otherwise.
 */
-int
+static int
 init_device()
 {
   int rc;
diff --git a/kml.cc b/kml.cc
index b03f5c565df3c716356ce695f0a445824d78e4a4..164e5960b20da3cd7d346dfc7823ea95194fd07a 100644 (file)
--- a/kml.cc
+++ b/kml.cc
@@ -604,7 +604,7 @@ kml_wr_position_deinit()
 }
 
 
-void
+static void
 kml_output_linestyle(char* /*color*/, int width)
 {
   // Style settings for line strings
@@ -1904,7 +1904,7 @@ static void kml_route_tlr(const route_head* header)
 // For Earth 5.0 and later, we write a LookAt that encompasses
 // the bounding box of our entire data set and set the event times
 // to include all our data.
-void kml_write_AbstractView()
+static void kml_write_AbstractView()
 {
   double bb_size;
 
@@ -1975,7 +1975,7 @@ void kml_mt_array_schema(const char* field_name, const char* display_name,
   writer->writeEndElement(); // Close gx:SimpleArrayField tag
 }
 
-void kml_write()
+static void kml_write()
 {
   const global_trait* traits = get_traits();
 
diff --git a/lmx.cc b/lmx.cc
index fc0ba90ef5e6847a43386f94871fd56a544c2380..5bc2fa27e9a747d7f165e2b52480beda4eeb2c41 100644 (file)
--- a/lmx.cc
+++ b/lmx.cc
@@ -33,8 +33,8 @@
 
 static gbfile* ofd;
 static Waypoint* wpt_tmp;
-QString urllink;
-QString urllinkt;
+static QString urllink;
+static QString urllinkt;
 static char* binary = nullptr;
 
 #define MYNAME "lmx"
index b35a6957b9d3be4023bb79c6d7f8169348edcf00..ac91e13def98591e2ee2281cea141d7662bee4d1 100644 (file)
@@ -378,7 +378,7 @@ mag_handoff()
   magrxstate = mrs_handoff;
 }
 
-void
+static void
 mag_verparse(char* ibuf)
 {
   int prodid = mm_unknown;
index 65ade95e37108b62d8039754762bfafff4935da6..b1dbb8d8d1939d3d63a5c9bfd832554c5dda68aa 100755 (executable)
@@ -276,7 +276,7 @@ print <<'END';
 \r
  */\r
 \r
-struct defguid {\r
+static struct defguid {\r
        GUID guid;\r
        const char *name;\r
 } default_guids[] = {\r
@@ -287,7 +287,7 @@ sub print_footer {
 print <<'END';\r
 };\r
 \r
-int FindIconByName( const char *name, GUID *guid ) {\r
+static int FindIconByName( const char *name, GUID *guid ) {\r
        unsigned int i = 0; \r
        for ( i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++ )\r
        {\r
@@ -299,7 +299,7 @@ int FindIconByName( const char *name, GUID *guid ) {
        return 0;\r
 }\r
 \r
-int FindIconByGuid( GUID *guid, char **name ) {\r
+static int FindIconByGuid( GUID *guid, char **name ) {\r
        unsigned int i = 0; \r
        for ( i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++ )\r
        {\r
index e7a104d96c4c17803f16702039dd9fae1ef36c6a..d292923d77d10d4873ac7fd550ec4ab878d9cc0e 100644 (file)
@@ -40,7 +40,7 @@ static  const double milliarcseconds = 60.0 * 60.0 * 1000.0;
 
 geocache_container wpt_container(const QString&);
 
-void MapfactorRead()
+static void MapfactorRead()
 {
   Waypoint* wpt = nullptr;
 
index 639ec547e2d17a378f20e45b07a947ee4295ba79..ccd6df0359b43fc7b1c7eb52c44354e85566be5d 100644 (file)
@@ -402,7 +402,7 @@ mapsend_route_disp(const Waypoint* waypointp)
   gbfwrite(&c, 1, 1, mapsend_file_out);
 }
 
-void mapsend_track_hdr(const route_head* trk)
+static void mapsend_track_hdr(const route_head* trk)
 {
   /*
    * we write mapsend v3.0 tracks as mapsend v2.0 tracks get
@@ -452,7 +452,7 @@ void mapsend_track_hdr(const route_head* trk)
 
 }
 
-void mapsend_track_disp(const Waypoint* wpt)
+static void mapsend_track_disp(const Waypoint* wpt)
 {
   unsigned char c;
   int32_t t;
@@ -502,7 +502,7 @@ void mapsend_track_disp(const Waypoint* wpt)
   }
 }
 
-void
+static void
 mapsend_track_write()
 {
   track_disp_all(mapsend_track_hdr, mapsend_noop, mapsend_track_disp);
index d2ecb031d1c127ebb3f4ac808718861f76ebd1ae..916046cad0bc005c9d7bca815dfa90b7271374ee 100644 (file)
@@ -112,13 +112,13 @@ mps_noop(const route_head*)
   /* no-op */
 }
 
-void
+static void
 mps_wpt_q_init(queue* whichQueue)
 {
   QUEUE_INIT(whichQueue);
 }
 
-void
+static void
 mps_wpt_q_deinit(queue* whichQueue)
 {
   queue* elem, *tmp;
@@ -133,7 +133,7 @@ mps_wpt_q_deinit(queue* whichQueue)
  * Find a waypoint that we've already written out
  *
  */
-Waypoint*
+static Waypoint*
 mps_find_wpt_q_by_name(const queue* whichQueue, const QString& name)
 {
   queue* elem, *tmp;
@@ -152,7 +152,7 @@ mps_find_wpt_q_by_name(const queue* whichQueue, const QString& name)
  * Add a waypoint that we've already written out to our list
  *
  */
-void
+static void
 mps_wpt_q_add(const queue* whichQueue, const Waypoint* wpt)
 {
   Waypoint* written_wpt = new Waypoint(*wpt);
@@ -1812,7 +1812,7 @@ mps_read()
 
 }
 
-void
+static void
 mps_write()
 {
   int                          short_length;
index dd583cd5b96f54d35aff0a7885e4c083515d2525..e805846148a82794a008d3b72e6c4e6859a44735 100644 (file)
@@ -51,7 +51,7 @@ static char* opt_erase;
 static char* opt_status;
 static char* opt_enable;
 
-arglist_t mtk_locus_args[] = {
+static arglist_t mtk_locus_args[] = {
   {"baudrate", &opt_baudrate, "Speed in bits per second of serial port (autodetect=0)", "0", ARGTYPE_INT, ARG_NOMINMAX , nullptr},
   {"download", &opt_download, "Download logged fixes", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr },
   {"erase", &opt_erase, "Erase device data after download", "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr },
index b329fad1b2ee304300c9ff985a8a1502c4618749..3783f4d83be89a661d7aeeffe6d14da1eeb13ddc 100644 (file)
@@ -158,7 +158,7 @@ enum {
   DISTANCE,
 } /* DATA_TYPES */;
 
-struct log_type {
+static struct log_type {
   int id;
   int size;
   const char* name;
@@ -189,7 +189,7 @@ struct log_type {
 struct sat_info {
   char id, used;
   short elevation, azimut, snr;
-} sat_info;
+};
 
 struct data_item {
   time_t timestamp;
@@ -207,14 +207,14 @@ struct data_item {
   unsigned short timestamp_ms;
   double distance;
   struct sat_info sat_data[32];
-} data_item;
+};
 
 struct mtk_loginfo {
   unsigned int bitmask;
   int logLen;
   int period, distance, speed; /* in 10:ths of sec, m, km/h */
   int track_event;
-} mtk_loginfo;
+};
 
 /* *************************************** */
 
@@ -241,7 +241,7 @@ static char* csv_file; /* csv ? command option */
 static char* OPT_block_size_kb; /* block_size_kb ? command option */
 static enum MTK_DEVICE_TYPE mtk_device = MTK_LOGGER;
 
-struct mtk_loginfo mtk_info;
+static struct mtk_loginfo mtk_info;
 
 const char LIVE_CHAR[4] = {'-', '\\','|','/'};
 
@@ -1123,7 +1123,7 @@ static int csv_line(gbfile* csvFile, int idx, unsigned long bmask, struct data_i
 
 
 /********************* MTK Logger -- Parse functions *********************/
-int mtk_parse(unsigned char* data, int dataLen, unsigned int bmask)
+static int mtk_parse(unsigned char* data, int dataLen, unsigned int bmask)
 {
   static int count = 0;
   int i, k, sat_id, hspd;
diff --git a/nmea.cc b/nmea.cc
index fb2120ec5721c70e6e0345aeb6e2123e96dca5a7..fb0cd7209ebcd6fdb3a139f98d04afc194f05518 100644 (file)
--- a/nmea.cc
+++ b/nmea.cc
@@ -197,7 +197,7 @@ static int had_checksum;
 static Waypoint* nmea_rd_posn(posn_status*);
 static void nmea_rd_posn_init(const QString& fname);
 
-arglist_t nmea_args[] = {
+static arglist_t nmea_args[] = {
   {"snlen", &snlenopt, "Max length of waypoint name to write", "6", ARGTYPE_INT, "1", "64", nullptr },
   {"gprmc", &opt_gprmc, "Read/write GPRMC sentences", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr },
   {"gpgga", &opt_gpgga, "Read/write GPGGA sentences", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr },
@@ -772,7 +772,7 @@ double pcmpt_deg(int d)
   return (double) deg + minutes;
 }
 
-void
+static void
 pcmpt_parse(char* ibuf)
 {
   int i, j1, j2, j3, j4, j5, j6;
@@ -926,7 +926,7 @@ notalkerid_strmatch(const char * s1, const char *sentenceFormatterMnemonicCode)
 return strncmp(s1,"$",1) || strncmp(s1+3,sentenceFormatterMnemonicCode,3) || strncmp(s1+6,",",1);
 }
 
-void
+static void
 nmea_parse_one_line(char* ibuf)
 {
   char* ck;
@@ -1252,13 +1252,13 @@ nmea_wayptpr(const Waypoint* wpt)
     gb_sleep(sleepus);
   }
 }
-void
+static void
 nmea_track_init(const route_head*)
 {
   last_time = -1;
 }
 
-void
+static void
 nmea_trackpt_pr(const Waypoint* wpt)
 {
   char obuf[200];
diff --git a/ozi.cc b/ozi.cc
index 9ff9eee48c222e976dc2b14c02831cbb02e72e2e..2f8e1f409fc01f2d4b3e637a5354763123e84911 100644 (file)
--- a/ozi.cc
+++ b/ozi.cc
@@ -151,7 +151,7 @@ ozi_alloc_fsdata()
   return fsdata;
 }
 
-void
+static void
 ozi_get_time_str(const Waypoint* waypointp, char* buff, gbsize_t buffsz)
 {
   if (waypointp->creation_time.isValid()) {
@@ -162,7 +162,7 @@ ozi_get_time_str(const Waypoint* waypointp, char* buff, gbsize_t buffsz)
   }
 }
 
-void
+static void
 ozi_set_time_str(const QString& str, Waypoint* waypointp)
 {
   double ozi_time = str.toDouble();
diff --git a/pcx.cc b/pcx.cc
index 5daa6da4849aeda25a4f9a05a01fd9857cf15480..935629755bbf3eb82ecaedee364678ac191f380a 100644 (file)
--- a/pcx.cc
+++ b/pcx.cc
@@ -356,7 +356,7 @@ static void pcx_route_hdr(const route_head* rte) {
             ";waypts\n");
 }
 
-void pcx_track_disp(const Waypoint* wpt) {
+static void pcx_track_disp(const Waypoint* wpt) {
   double lon, lat;
 
   lon = degrees2ddmm(wpt->longitude);
index 5c3d9cf14ffe39acb8f36d6dde694d5d83057727..5c6d1f1b81874860e43be406a06c8827b036e2d0 100644 (file)
@@ -33,7 +33,7 @@ rd_init(const QString& fname)
   file_in = gbfopen_le(fname, "r", MYNAME);
 }
 
-double wppos_to_dec(char* value)
+static double wppos_to_dec(char* value)
 {
   if (strstr(value, "\xB0") == nullptr) {
     return atof(value);
index 1f4ade8b94ae1240b35b0ef9977c904fb528de60..98dec26e4065423bff8f9df324296aaaea87b977 100644 (file)
@@ -233,7 +233,7 @@ static void polytest(double lat1, double lon1,
 
 #define BADVAL 999999
 
-void
+static void
 polygon_process()
 {
   queue* elem, * tmp;
@@ -340,13 +340,13 @@ polygon_process()
   }
 }
 
-void
+static void
 polygon_init(const char*)
 {
   /* do nothing */
 }
 
-void
+static void
 polygon_deinit()
 {
   /* do nothing */
index 5d532e2729989b72f85526ebf721fb9c2e51f8df..82fd98cb7c35f1e10da06f551b02f827cdd7e9e0 100644 (file)
@@ -200,7 +200,7 @@ position_noop_t(const route_head*)
 {
 }
 
-void position_process()
+static void position_process()
 {
   int i = waypt_count();
 
@@ -212,7 +212,7 @@ void position_process()
   track_disp_all(position_process_trk, position_noop_t, position_noop_w);
 }
 
-void
+static void
 position_init(const char*)
 {
   char* fm;
@@ -236,7 +236,7 @@ position_init(const char*)
   }
 }
 
-void
+static void
 position_deinit()
 {
 }
index 74713c17cbe634a622d3cfb934d207e84eab04ef..b0fec479fc6930668e8eacc5f5362dc189c99f77 100644 (file)
@@ -51,7 +51,7 @@ static int    psit_track_state = 2;
 
 static char psit_current_token[256];
 
-char* snlen;
+static char* snlen;
 
 static
 arglist_t psit_args[] = {
@@ -753,7 +753,7 @@ psit_noop(const route_head*)
   /* no-op */
 }
 
-void
+static void
 psit_write()
 {
   int short_length;
index a999f5bffbae8f11484cd3c541839e1d847a7dd7..3d29df98e08b178b6c2286f58d92e24b7ab333a9 100644 (file)
--- a/radius.cc
+++ b/radius.cc
@@ -108,7 +108,7 @@ dist_comp(const void* a, const void* b)
 
 }
 
-void
+static void
 radius_process()
 {
 #if !NEWQ
@@ -202,7 +202,7 @@ radius_process()
   xfree(comp);
 }
 
-void
+static void
 radius_init(const char*)
 {
   char* fm;
@@ -234,7 +234,7 @@ radius_init(const char*)
   }
 }
 
-void
+static void
 radius_deinit()
 {
   if (home_pos) {
index f928480553728bd5611d2e1e705f1709c41dff4d..a564b366961c611bc8b91c657897e49f15700cae 100644 (file)
@@ -48,21 +48,21 @@ static void reverse_route_wpt(const Waypoint* waypointp)
   prev_new_trkseg = curr_new_trkseg;
 }
 
-void
+static void
 reverse_route_head(const route_head* rte)
 {
   route_reverse(rte);
   prev_new_trkseg = 1;
 }
 
-void
+static void
 reverse_route_process()
 {
   track_disp_all(reverse_route_head, nullptr, reverse_route_wpt);
   route_disp_all(reverse_route_head, nullptr, nullptr);
 }
 
-void
+static void
 reverse_route_init(const char*)
 {
   switch (global_opts.objective) {
@@ -76,7 +76,7 @@ reverse_route_init(const char*)
   }
 }
 
-void
+static void
 reverse_route_deinit()
 {
   /* do nothing */
index fc17691aee4b328075f7a7474a2634cb3f8e5464..d1cc2ff7df4861c642ae24294b02e5404686d131 100644 (file)
 #include "grtcirc.h"
 #include <cstddef>
 
-gbfile* infile;
+static gbfile* infile;
 
-char* turns_important = nullptr;
-char* turns_only = nullptr;
-char* controls = nullptr;
-char* split = nullptr;
-char* timesynth = nullptr;
+static char* turns_important = nullptr;
+static char* turns_only = nullptr;
+static char* controls = nullptr;
+static char* split = nullptr;
+static char* timesynth = nullptr;
 
-int control = 0;
+static int control = 0;
 
 static
 arglist_t saroute_args[] = {
@@ -64,7 +64,7 @@ arglist_t saroute_args[] = {
 #define ReadShort(f) gbfgetint16(f)
 #define ReadLong(f) gbfgetint32(f)
 
-unsigned char*
+static unsigned char*
 ReadRecord(gbfile* f, gbsize_t size)
 {
   unsigned char* result = (unsigned char*) xmalloc(size);
@@ -73,7 +73,7 @@ ReadRecord(gbfile* f, gbsize_t size)
   return result;
 }
 
-void
+static void
 Skip(gbfile* f, gbsize_t distance)
 {
   gbfseek(f, distance, SEEK_CUR);
index 56396db355766871ed724e8eeffabdd320c24be3..1cdeb280d5f1faf2779cc765bf7cef28ddc891ee 100644 (file)
--- a/shape.cc
+++ b/shape.cc
@@ -64,7 +64,7 @@ arglist_t shp_args[] = {
 /*                              SHPOpenGpsbabel()                       */
 /************************************************************************/
 
-SHPHandle SHPAPI_CALL
+static SHPHandle SHPAPI_CALL
 SHPOpenGpsbabel(const QString& pszLayer, const char* pszAccess)
 
 {
@@ -87,7 +87,7 @@ SHPOpenGpsbabel(const QString& pszLayer, const char* pszAccess)
 /*      shape file with read/write access.                              */
 /************************************************************************/
 
-SHPHandle SHPAPI_CALL
+static SHPHandle SHPAPI_CALL
 SHPCreateGpsbabel(const QString& pszLayer, int nShapeType)
 
 {
@@ -109,7 +109,7 @@ SHPCreateGpsbabel(const QString& pszLayer, int nShapeType)
 /*      Open a .dbf file.                                               */
 /************************************************************************/
 
-DBFHandle SHPAPI_CALL
+static DBFHandle SHPAPI_CALL
 DBFOpenGpsbabel(const QString& pszFilename, const char* pszAccess)
 
 {
@@ -131,7 +131,7 @@ DBFOpenGpsbabel(const QString& pszFilename, const char* pszAccess)
 /*      Create a new .dbf file.                                         */
 /************************************************************************/
 
-DBFHandle SHPAPI_CALL
+static DBFHandle SHPAPI_CALL
 DBFCreateExGpsbabel(const QString& pszFilename, const char* pszCodePage)
 
 {
@@ -147,18 +147,20 @@ DBFCreateExGpsbabel(const QString& pszFilename, const char* pszCodePage)
 
 }
 
+#ifdef DEAD_CODE_IS_REBORN
 /************************************************************************/
 /*                             DBFCreateGpsbabel()                      */
 /*                                                                      */
 /* Create a new .dbf file with default code page LDID/87 (0x57)         */
 /************************************************************************/
 
-DBFHandle SHPAPI_CALL
+static DBFHandle SHPAPI_CALL
 DBFCreateGpsbabel(const QString& pszFilename)
 
 {
   return DBFCreateExGpsbabel(pszFilename, "LDID/87");   // 0x57
 }
+#endif
 
 static
 void dump_fields(void)
@@ -220,7 +222,7 @@ my_rd_init(const QString& fname)
   }
 }
 
-void
+static void
 my_read(void)
 {
   // option processing here instead of in my_rd_init
@@ -396,7 +398,7 @@ err:
 
 }
 
-void
+static void
 my_rd_deinit(void)
 {
   SHPClose(ihandle);
@@ -404,13 +406,13 @@ my_rd_deinit(void)
   ifname.clear();
 }
 
-void
+static void
 my_wr_init(const QString& fname)
 {
   ofname = fname;
 }
 
-void
+static void
 my_wr_deinit(void)
 {
   SHPClose(ohandle);
@@ -418,7 +420,7 @@ my_wr_deinit(void)
   ofname.clear();
 }
 
-void
+static void
 my_write_wpt(const Waypoint* wpt)
 {
   SHPObject* shpobject;
@@ -437,7 +439,7 @@ my_write_wpt(const Waypoint* wpt)
                           CSTR(wpt->shortname));
 }
 
-void
+static void
 poly_init(const route_head* rte)
 {
   const int ct = rte->rte_waypt_ct;
@@ -448,7 +450,7 @@ poly_init(const route_head* rte)
 }
 
 
-void
+static void
 poly_point(const Waypoint* wpt)
 {
   polybufx[poly_count] = wpt->longitude;
@@ -457,7 +459,7 @@ poly_point(const Waypoint* wpt)
   poly_count++;
 }
 
-void
+static void
 poly_deinit(const route_head* rte)
 {
   SHPObject* shpobject;
@@ -478,7 +480,7 @@ poly_deinit(const route_head* rte)
 }
 
 
-void
+static void
 my_write(void)
 {
   // shape files can only contain one shape type in addition
index acc1ac279cdc02ab9cea4de9ee81fcf12e864ecf..ff3f9a9210fe71d6d5d0cc1a63c827f7f9886040 100644 (file)
@@ -256,9 +256,9 @@ wr_buf(const unsigned char* str, int len)
 * %%%        SkyTraq protocol implementation                               %%% *
 *******************************************************************************/
 
-uint8_t NL[2] = { 0x0D, 0x0A };
-uint8_t MSG_START[2] = { 0xA0, 0xA1 };
-uint8_t SECTOR_READ_END[13] = { 'E','N','D', 0, 'C','H','E','C','K','S','U','M','=' };
+static uint8_t NL[2] = { 0x0D, 0x0A };
+static uint8_t MSG_START[2] = { 0xA0, 0xA1 };
+static uint8_t SECTOR_READ_END[13] = { 'E','N','D', 0, 'C','H','E','C','K','S','U','M','=' };
 
 static int
 skytraq_calc_checksum(const unsigned char* buf, int len)
@@ -1469,7 +1469,7 @@ static char* opt_set_poi_car = nullptr;   /* set if a "poi" option was used */
 static char* opt_set_poi_boat = nullptr;       /* set if a "poi" option was used */
 static char* opt_set_poi_heart = nullptr;      /* set if a "poi" option was used */
 static char* opt_set_poi_bar = nullptr;        /* set if a "poi" option was used */
-arglist_t miniHomer_args[] = {
+static arglist_t miniHomer_args[] = {
   { "baud",         &opt_dlbaud,        "Baud rate used for download", "115200", ARGTYPE_INT, "0", "115200", nullptr },
   { "dump-file",    &opt_dump_file,     "Dump raw data to this file", nullptr, ARGTYPE_OUTFILE, ARG_NOMINMAX, nullptr },
   { "erase",        &opt_erase,         "Erase device data after download", "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr },
@@ -1492,7 +1492,8 @@ static const char* poinames[] = {
   "Home", "Car", "Boat", "Heart", "Bar"
 };
 #define NUMPOI (sizeof poinames/sizeof poinames[0])
-int getPoiByName(char* name)
+#ifdef DEAD_CODE_IS_REBORN
+static int getPoiByName(char* name)
 {
   unsigned int i;
   for (i=0; i<NUMPOI; i++) {
@@ -1502,12 +1503,13 @@ int getPoiByName(char* name)
   }
   return -1;
 }
+#endif
 // Convert lla (lat, lng, alt) to ECEF
 // Algorith taken from these sources:
 // http://www.mathworks.com/matlabcentral/fileexchange/7942-covert-lat-lon-alt-to-ecef-cartesian
 // http://en.wikipedia.org/wiki/Geodetic_system#From_ECEF_to_geodetic
 // http://earth-info.nga.mil/GandG/publications/tr8350.2/wgs84fin.pdf
-void lla2ecef(double lat, double lng, double alt, double* ecef_x, double* ecef_y, double* ecef_z)
+static void lla2ecef(double lat, double lng, double alt, double* ecef_x, double* ecef_y, double* ecef_z)
 {
   long double n;
   long double a = 6378137.0;
index bef8bf4de0ae79a55a9ff79cd9d15c76b7618034..eb79836676875f858f21dd291670bd211ef3e962 100644 (file)
@@ -74,7 +74,7 @@ static char* erroropt;
 static char* xteopt;
 static char* lenopt;
 static char* relopt;
-void (*waypt_del_fnp)(route_head* rte, Waypoint* wpt);
+static void (*waypt_del_fnp)(route_head* rte, Waypoint* wpt);
 
 static
 arglist_t routesimple_args[] = {
@@ -116,7 +116,7 @@ struct xte_intermed {
   const Waypoint* wpt;
 };
 
-void
+static void
 free_xte(struct xte* xte_rec)
 {
   xfree(xte_rec->intermed);
@@ -129,7 +129,7 @@ static int xte_count = 0;
 static const route_head* cur_rte = nullptr;
 static struct xte* xte_recs = nullptr;
 
-void
+static void
 routesimple_waypt_pr(const Waypoint* wpt)
 {
   if (!cur_rte) {
@@ -148,7 +148,7 @@ routesimple_waypt_pr(const Waypoint* wpt)
   xte_count++;
 }
 
-void
+static void
 compute_xte(struct xte* xte_rec)
 {
   const Waypoint* wpt3 = xte_rec->intermed->wpt;
@@ -210,7 +210,7 @@ compute_xte(struct xte* xte_rec)
 }
 
 
-int
+static int
 compare_xte(const void* a, const void* b)
 {
   double distdiff = ((struct xte*)a)->distance -
@@ -241,7 +241,7 @@ compare_xte(const void* a, const void* b)
   return 0;
 }
 
-void
+static void
 routesimple_head(const route_head* rte)
 {
   cur_rte = nullptr;
@@ -265,7 +265,7 @@ routesimple_head(const route_head* rte)
 
 }
 
-void
+static void
 shuffle_xte(struct xte* xte_rec)
 {
   struct xte tmp_xte;
@@ -300,7 +300,7 @@ shuffle_xte(struct xte* xte_rec)
   }
 }
 
-void
+static void
 routesimple_tail(const route_head* rte)
 {
   int i;
@@ -372,7 +372,7 @@ routesimple_tail(const route_head* rte)
   xfree(xte_recs);
 }
 
-void
+static void
 routesimple_process()
 {
   waypt_del_fnp = route_del_wpt;
@@ -382,7 +382,7 @@ routesimple_process()
   track_disp_all(routesimple_head, routesimple_tail, routesimple_waypt_pr);
 }
 
-void
+static void
 routesimple_init(const char*)
 {
   count = 0;
@@ -410,7 +410,7 @@ routesimple_init(const char*)
   }
 }
 
-void
+static void
 routesimple_deinit()
 {
   /* do nothing */
diff --git a/sort.cc b/sort.cc
index 6d51336d884f417d2fb9e51f1aaedea8c4763cfa..b4ff6b00c5380c8484ab78752e030a8ac9d9de7c 100644 (file)
--- a/sort.cc
+++ b/sort.cc
@@ -32,7 +32,7 @@ typedef enum {
   sm_time
 } sort_mode_;
 
-sort_mode_ sort_mode = sm_shortname;   /* How are we sorting these? */
+static sort_mode_ sort_mode = sm_shortname;    /* How are we sorting these? */
 
 static char* opt_sm_gcid, *opt_sm_shortname, *opt_sm_description, *opt_sm_time;
 
@@ -78,13 +78,13 @@ sort_comp(const queue* a, const queue* b)
   }
 }
 
-void
+static void
 sort_process()
 {
   sortqueue(&waypt_head, sort_comp);
 }
 
-void
+static void
 sort_init(const char*)
 {
   if (opt_sm_gcid) {
index d66f52287b91e953bd0bcf4b3275250ef5e4c0bc..a774df786906a2e5dcaefb1b0b87e8b65cbfcf56 100644 (file)
@@ -80,7 +80,7 @@ arglist_t stackfilt_args[] = {
   ARG_TERMINATOR
 };
 
-struct stack_elt {
+static struct stack_elt {
   queue waypts;
   queue routes;
   queue tracks;
@@ -91,7 +91,7 @@ struct stack_elt {
 }* stack = nullptr;
 
 
-void
+static void
 stackfilt_process()
 {
   struct stack_elt* tmp_elt = nullptr;
@@ -191,7 +191,7 @@ stackfilt_process()
   }
 }
 
-void
+static void
 stackfilt_init(const char*)
 {
 
@@ -231,13 +231,13 @@ stackfilt_init(const char*)
 
 }
 
-void
+static void
 stackfilt_deinit()
 {
   swapdepth = 0;
 }
 
-void
+static void
 stackfilt_exit()
 {
   struct stack_elt* tmp_elt = nullptr;
index 61bc2fffdeb12e511aa6372fea0f909dc8bf1ede..da20ca93b8cc428f20efb5e1d597a37d0a8ac63f 100644 (file)
--- a/subrip.cc
+++ b/subrip.cc
@@ -262,7 +262,7 @@ subrip_write()
 
 /* arguments: definitions of format-specific arguments */
 
-arglist_t subrip_args[] = {
+static arglist_t subrip_args[] = {
   // FIXME: document that gps_date and gps_time must be specified together or they will both be ignored and the timestamp of the first trackpoint will be used.
   {"video_time", &opt_videotime, "Video position for which exact GPS time is known (hhmmss, default is 0:00:00)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr },
   {"gps_time", &opt_gpstime, "GPS time at position video_time (hhmmss, default is first timestamp of track)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr },
index 68485c8611202825765f68264d2eb026b31180af..d8e3551328943dbbcadb5455fe5166699644b42c 100644 (file)
--- a/tomtom.cc
+++ b/tomtom.cc
@@ -80,10 +80,11 @@ wr_deinit()
 #define read_long(f) gbfgetint32((f))
 #define read_char(f) gbfgetc((f))
 
+#ifdef DEAD_CODE_IS_REBORN
 /*
  *  Decode a type 8 compressed record
  */
-char*
+static char*
 decode_8(int sz, const unsigned char* inbuf)
 {
   static const char encoding_8[] = "X. SaerionstldchumgpbkfzvACBMPG-";
@@ -122,8 +123,10 @@ decode_8(int sz, const unsigned char* inbuf)
   }
   return rval;
 }
+#endif
 
-void
+#ifdef DEAD_CODE_IS_REBORN
+static void
 decode_latlon(double* lat, double* lon)
 {
   unsigned char latbuf[3];
@@ -138,6 +141,7 @@ decode_latlon(double* lat, double* lon)
   *lon = rlon = 123.456;
 
 }
+#endif
 
 static void
 check_recsize(int sz)
diff --git a/tpo.cc b/tpo.cc
index d2901e9ec260c06be1e8063d9961fef89689e40d..2fec96f3f313957345a129152ac2c798aa9964d0 100644 (file)
--- a/tpo.cc
+++ b/tpo.cc
@@ -132,7 +132,7 @@ static double last_waypoint_z;
 /*******************************************************************************/
 
 /* Define a global here that we can query from multiple places */
-float tpo_version = 0.0;
+static float tpo_version = 0.0;
 
 /* tpo_check_version_string()
    Check the first bytes of the file for a version 3.0 header. */
@@ -256,7 +256,7 @@ tpo_read_until_section(const char* section_name, int seek_bytes)
 // that is the only type of data available in the version 2.x TPO
 // files.
 //
-void tpo_read_2_x()
+static void tpo_read_2_x()
 {
   char buff[16];
   short track_count, waypoint_count;
@@ -376,7 +376,7 @@ void tpo_read_2_x()
 //
 // For version 3.x files.
 //
-int tpo_read_int()
+static int tpo_read_int()
 {
   unsigned char val;
 
@@ -416,7 +416,7 @@ int tpo_read_int()
 //
 // For version 3.x files.
 //
-int tpo_find_block(unsigned int block_desired)
+static int tpo_find_block(unsigned int block_desired)
 {
   unsigned int block_type;
   unsigned int block_offset;
@@ -453,7 +453,7 @@ int tpo_find_block(unsigned int block_desired)
 //
 // For version 3.x files.
 //
-Waypoint* tpo_convert_ll(int lat, int lon)
+static Waypoint* tpo_convert_ll(int lat, int lon)
 {
   double latitude;
   double longitude;
@@ -510,7 +510,7 @@ public:
 // Track decoder for version 3.x files.  This block contains tracks
 // (called "freehand routes" or just "routes" in Topo).
 //
-void tpo_process_tracks()
+static void tpo_process_tracks()
 {
   unsigned int track_count, track_style_count;
   unsigned int xx,ii,tmp;
@@ -812,12 +812,12 @@ void tpo_process_tracks()
 //
 // For version 3.x files.
 //
-Waypoint** tpo_wp_index;
-unsigned int tpo_index_ptr;
+static Waypoint** tpo_wp_index;
+static unsigned int tpo_index_ptr;
 
 // Waypoint decoder for version 3.x files.
 //
-void tpo_process_waypoints()
+static void tpo_process_waypoints()
 {
   unsigned int waypoint_count;
   unsigned int ii;
@@ -938,7 +938,7 @@ void tpo_process_waypoints()
 
 // Map Notes decoder for version 3.x files.
 //
-void tpo_process_map_notes()
+static void tpo_process_map_notes()
 {
   unsigned int waypoint_count;
   unsigned int ii;
@@ -1055,7 +1055,7 @@ void tpo_process_map_notes()
 
 // Symbols decoder for version 3.x files.
 //
-void tpo_process_symbols()
+static void tpo_process_symbols()
 {
   unsigned int waypoint_count;
   unsigned int ii;
@@ -1110,7 +1110,7 @@ void tpo_process_symbols()
 
 // Text Labels decoder for version 3.x files.
 //
-void tpo_process_text_labels()
+static void tpo_process_text_labels()
 {
   unsigned int waypoint_count;
   unsigned int ii;
@@ -1185,7 +1185,7 @@ void tpo_process_text_labels()
 // with pointers to waypoint objects by tpo_process_waypoints()
 // function above.
 //
-void tpo_process_routes()
+static void tpo_process_routes()
 {
   unsigned int route_count;
   unsigned int ii;
@@ -1280,13 +1280,15 @@ void tpo_process_routes()
 
 
 
+#ifdef DEAD_CODE_IS_REBORN
 // Compass decoder for version 3.x files.
 //
-void tpo_process_compass()
+static void tpo_process_compass()
 {
 
   // Not implemented yet
 }
+#endif
 
 
 
@@ -1296,7 +1298,7 @@ void tpo_process_compass()
 // (called "freehand routes" or just "routes" in Topo), "waypoints",
 // and "gps-routes".  We intend to read all three types.
 //
-void tpo_read_3_x()
+static void tpo_read_3_x()
 {
 
   if (doing_trks) {
diff --git a/v900.cc b/v900.cc
index 4ec816ba0698243679b5ba6a3d2fde619a242a64..aaa680ebfe3207c14c62046d62eae63a29826faf 100644 (file)
--- a/v900.cc
+++ b/v900.cc
@@ -182,7 +182,7 @@ v900_rd_deinit()
 }
 
 /* copied from dg-100.c - slight (incompatible) modification to how the date parameter is used */
-QDateTime
+static QDateTime
 bintime2utc(int date, int time) {
   int secs = time % 100;
   time /= 100;
index 61a3ec188884b75ba68142f29f3bed367a7af237..2aa67434f55abc8b18eb071bbde30e1f0edb04be 100644 (file)
@@ -28,9 +28,9 @@
 #define MYNAME "validate"
 
 static char* opt_debug;
-bool debug;
+static bool debug;
 static char* opt_checkempty;
-bool checkempty;
+static bool checkempty;
 static unsigned int point_ct;
 static unsigned int head_ct;
 static unsigned int segment_ct_start;
diff --git a/vpl.cc b/vpl.cc
index 426509f69e92360c1a768edb763bb624d682892f..48f343bc90c7a1ba90539b4533f7850c891a44cd 100644 (file)
--- a/vpl.cc
+++ b/vpl.cc
@@ -111,7 +111,7 @@ C - Checksum
 
 #define MYNAME "vpl"
 
-void vpl_parse_75_sentence(const char*);
+static void vpl_parse_75_sentence(const char*);
 
 static
 arglist_t vpl_args[] = {
index 19a2c7fbcad06b0c274d6ccda818947ce213cf41..67ad63f3098c465acedbf11abc0c9397dc82129a 100644 (file)
@@ -199,7 +199,7 @@ void wfff_e(xg_string, const QXmlStreamAttributes*)
   }
 }
 
-void
+static void
 wfff_xml_rd_init(const QString& fname)
 {
   tosscount = 0;
@@ -208,13 +208,13 @@ wfff_xml_rd_init(const QString& fname)
 }
 
 void
-wfff_xml_read()
+static wfff_xml_read()
 {
   xml_read();
 }
 
 void
-wfff_xml_rd_deinit()
+static wfff_xml_rd_deinit()
 {
   xml_deinit();